param($xaxis, $yaxis)

begin {
$categories = @()
$values = @()
$chart = new-object -com OWC11.ChartSpace.11
 $chart.Clear()
 $c = $chart.charts.Add(0) 
 $c.Type = 4 
 $c.HasTitle = $true  
 $c.Title.Caption = "Chart generated on $(get-date)" 
 $series = ([array] $chart.charts)[0].SeriesCollection.Add(0)
}

Process {
$categories += $_.$xaxis 
 $values += $_.$yaxis *1
}

End {
 $series.Caption = "chart"
 $series.SetData(1, -1, $categories) 
 $series.SetData(2, -1, $values)
 $filename = (resolve-path .).Path + "\chart.jpg" 
 $chart.ExportPicture($filename, "jpg", 800,  500)
 invoke-item $filename
}
